package com.lanchetech.user.controller;

import com.lanchetech.bean.request.PageReq;
import com.lanchetech.bean.request.RelationshipReq;
import com.lanchetech.bean.response.BasePageResp;
import com.lanchetech.bean.response.BaseResp;
import com.lanchetech.bean.response.RelationshipResp;
import com.lanchetech.bean.response.ResultData;
import com.lanchetech.bean.vo.DiseaseReportVO;
import com.lanchetech.entity.Disease;
import com.lanchetech.entity.DiseaseReport;
import com.lanchetech.entity.DiseaseReportHistory;
import com.lanchetech.entity.User;
import com.lanchetech.user.service.DiseaseService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.annotation.AuthenticationPrincipal;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Api(value = "疾病接口", tags = "疾病接口")
@RequestMapping("/api/disease")
@RestController
public class DiseaseController {

    @Autowired
    DiseaseService diseaseService;

    @ApiOperation("获取所有疾病列表")
    @GetMapping("/getDiseaseList")
    public ResultData<List<Disease>> getDiseaseList() {
        return diseaseService.getDiseaseList();
    }

    @ApiOperation("编辑疾病报告")
    @PostMapping("/editDiseaseReport")
    public BaseResp editDiseaseReport(@RequestBody DiseaseReport req) {
        return diseaseService.editDiseaseReport(req);
    }

    @ApiOperation("获取我的疾病报告")
    @GetMapping("/getDiseaseReportDetail")
    public ResultData<DiseaseReportVO> getDiseaseReportDetail(@RequestParam(value = "userId", required = false) Long userId) {
        return diseaseService.getDiseaseReportDetail(userId);
    }

    @ApiOperation(value = "获取指定用户的历史疾病报告列表", notes = "userId 用户编号")
    @PostMapping("/getDiseaseReportHistory")
    public ResultData<BasePageResp<DiseaseReportHistory>> getDiseaseReportHistory(@RequestBody PageReq req) {
        return diseaseService.getDiseaseReportHistory(req);
    }
}
